package com.cwf.business;

import android.app.Application;
import android.content.Context;
import android.os.Vibrator;

import com.amap.api.location.AMapLocationClient;
import com.cwf.business.info.UserInfo;
import com.cwf.business.preferences.PreferencesUtils;

/**
 * Created by sam_chan on 2017/5/8.
 */

public class MyApplication extends Application {

    private static Context context;
    private UserInfo userInfo;
    public Vibrator mVibrator;
    private static AMapLocationClient mLocationClient;

    @Override
    public void onCreate() {
        super.onCreate();
        context = getApplicationContext();
        PreferencesUtils.createInstance(this);
        mLocationClient = new AMapLocationClient(this);

    }

    public static AMapLocationClient getAMapLocationClient() {
        return mLocationClient;
    }

    public static Context getContext() {
        return context;
    }

    public UserInfo getUserInfo() {
        return userInfo;
    }

    public void setUserInfo(UserInfo userInfo) {
        this.userInfo = userInfo;
    }

    public MyApplication() {
        userInfo = new UserInfo();
    }

    /**
     * 清除用户信息
     */
    public void clearUserInfo() {
        if (userInfo != null) {
            userInfo.setUserID(null);
            userInfo.setUserName(null);
        }
    }
}
